package deleteface.bank.jqsoft.cn.deleteface.webservice;

import android.support.annotation.NonNull;
import android.util.Log;

import java.io.IOException;

import deleteface.bank.jqsoft.cn.deleteface.base.BphsConstants;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * @author yedong
 * @date 2019/8/9
 * 网络拦截器切换网络
 */
public class NetChangeInterceptorNew implements Interceptor {

    NetChangeInterceptorNew() {
    }

    @NonNull
    @Override
    public Response intercept(@NonNull Chain chain) throws IOException {
        Request original = chain.request();
        String url = original.url().toString();
        String newUrl;  // 新的url

        String sJYEnd = ".wsdl"; // 家医url后缀
        String samePart = "";  // url相同部分
//        samePart = url.replace(RequestManager.BASE_URL,"");

        newUrl = url+sJYEnd;

        Log.d("okhttp","url:"+newUrl);
        Request newRequest = original.newBuilder()
                .url(newUrl)
                .build();
        return chain.proceed(newRequest);
    }
}
